/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.netbeans.microedition.lcdui.SimpleTableModel;
import org.netbeans.microedition.lcdui.TableItem;

/**
 * @author Бернар
 */
public class MainMenu extends MIDlet implements CommandListener, ItemCommandListener {

    private boolean midletPaused = false;

    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Command exitCommand;
    private Command okCommand;
    private Command cancelCommand;
    private Command okCommand1;
    private Command backCommand;
    private Command exitCommand1;
    private Form MainMenu;
    private ImageItem imageItem;
    private ImageItem imageItem1;
    private Spacer spacer4;
    private Spacer spacer1;
    private Spacer spacer2;
    private StringItem stringItem1;
    private StringItem stringItem4;
    private StringItem stringItem3;
    private StringItem stringItem2;
    private StringItem stringItem;
    private Form Help;
    private StringItem stringItem5;
    private TableItem tableItem;
    private Spacer spacer3;
    private Form Start;
    private ImageItem imageItem3;
    private Form form3;
    private StringItem stringItem6;
    private ImageItem imageItem2;
    private Spacer spacer;
    private ImageItem imageItem4;
    private Ticker ticker;
    private Font font1;
    private Font font;
    private Image image2;
    private Image image1;
    private SimpleTableModel tableModel1;
    private Image image3;
    private Image image4;
    private Image image6;
    private Image image5;
    private Image image7;
    //</editor-fold>//GEN-END:|fields|0|

    /**
     * The HelloMIDlet constructor.
     */
    public MainMenu() {
    }

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //</editor-fold>//GEN-END:|0-initialize|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getStart());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //</editor-fold>//GEN-END:|3-startMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
        switchDisplayable(null, getStart());//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //</editor-fold>//GEN-END:|4-resumeMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //</editor-fold>//GEN-END:|5-switchDisplayable|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == Help) {//GEN-BEGIN:|7-commandAction|1|87-preAction
            if (command == backCommand) {//GEN-END:|7-commandAction|1|87-preAction
                // write pre-action user code here
                switchDisplayable(null, getMainMenu());//GEN-LINE:|7-commandAction|2|87-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|3|143-preAction
        } else if (displayable == MainMenu) {
            if (command == exitCommand) {//GEN-END:|7-commandAction|3|143-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|4|143-postAction
                // write post-action user code here
            } else if (command == okCommand) {//GEN-LINE:|7-commandAction|5|30-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|6|30-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|7|82-preAction
        } else if (displayable == Start) {
            if (command == exitCommand1) {//GEN-END:|7-commandAction|7|82-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|8|82-postAction
                // write post-action user code here
            } else if (command == okCommand) {//GEN-LINE:|7-commandAction|9|78-preAction
                // write pre-action user code here
                switchDisplayable(null, getMainMenu());//GEN-LINE:|7-commandAction|10|78-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|11|70-preAction
        } else if (displayable == form3) {
            if (command == exitCommand) {//GEN-END:|7-commandAction|11|70-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|12|70-postAction
                // write post-action user code here
            } else if (command == okCommand) {//GEN-LINE:|7-commandAction|13|71-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|14|71-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|15|7-postCommandAction
        }//GEN-END:|7-commandAction|15|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|16|
    //</editor-fold>//GEN-END:|7-commandAction|16|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">//GEN-BEGIN:|18-getter|0|18-preInit
    /**
     * Returns an initiliazed instance of exitCommand component.
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {//GEN-END:|18-getter|0|18-preInit
            // write pre-init user code here
            exitCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|18-getter|1|18-postInit
            // write post-init user code here
        }//GEN-BEGIN:|18-getter|2|
        return exitCommand;
    }
    //</editor-fold>//GEN-END:|18-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: MainMenu ">//GEN-BEGIN:|14-getter|0|14-preInit
    /**
     * Returns an initiliazed instance of MainMenu component.
     * @return the initialized component instance
     */
    public Form getMainMenu() {
        if (MainMenu == null) {//GEN-END:|14-getter|0|14-preInit
            // write pre-init user code here
            MainMenu = new Form("Welcome", new Item[] { getSpacer1(), getSpacer2(), getImageItem(), getStringItem1(), getStringItem(), getStringItem2(), getStringItem3(), getStringItem4(), getImageItem1(), getSpacer4() });//GEN-BEGIN:|14-getter|1|14-postInit
            MainMenu.setTicker(getTicker());
            MainMenu.addCommand(getOkCommand());
            MainMenu.addCommand(getExitCommand());
            MainMenu.setCommandListener(this);//GEN-END:|14-getter|1|14-postInit
            // write post-init user code here
        }//GEN-BEGIN:|14-getter|2|
        return MainMenu;
    }
    //</editor-fold>//GEN-END:|14-getter|2|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand ">//GEN-BEGIN:|29-getter|0|29-preInit
    /**
     * Returns an initiliazed instance of okCommand component.
     * @return the initialized component instance
     */
    public Command getOkCommand() {
        if (okCommand == null) {//GEN-END:|29-getter|0|29-preInit
            // write pre-init user code here
            okCommand = new Command("Ok", Command.OK, 0);//GEN-LINE:|29-getter|1|29-postInit
            // write post-init user code here
        }//GEN-BEGIN:|29-getter|2|
        return okCommand;
    }
    //</editor-fold>//GEN-END:|29-getter|2|









    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: font ">//GEN-BEGIN:|31-getter|0|31-preInit
    /**
     * Returns an initiliazed instance of font component.
     * @return the initialized component instance
     */
    public Font getFont() {
        if (font == null) {//GEN-END:|31-getter|0|31-preInit
            // write pre-init user code here
            font = Font.getDefaultFont();//GEN-LINE:|31-getter|1|31-postInit
            // write post-init user code here
        }//GEN-BEGIN:|31-getter|2|
        return font;
    }
    //</editor-fold>//GEN-END:|31-getter|2|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: spacer1 ">//GEN-BEGIN:|40-getter|0|40-preInit
    /**
     * Returns an initiliazed instance of spacer1 component.
     * @return the initialized component instance
     */
    public Spacer getSpacer1() {
        if (spacer1 == null) {//GEN-END:|40-getter|0|40-preInit
            // write pre-init user code here
            spacer1 = new Spacer(16, 1);//GEN-LINE:|40-getter|1|40-postInit
            // write post-init user code here
        }//GEN-BEGIN:|40-getter|2|
        return spacer1;
    }
    //</editor-fold>//GEN-END:|40-getter|2|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: spacer2 ">//GEN-BEGIN:|47-getter|0|47-preInit
    /**
     * Returns an initiliazed instance of spacer2 component.
     * @return the initialized component instance
     */
    public Spacer getSpacer2() {
        if (spacer2 == null) {//GEN-END:|47-getter|0|47-preInit
            // write pre-init user code here
            spacer2 = new Spacer(16, 1);//GEN-LINE:|47-getter|1|47-postInit
            // write post-init user code here
        }//GEN-BEGIN:|47-getter|2|
        return spacer2;
    }
    //</editor-fold>//GEN-END:|47-getter|2|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: Help ">//GEN-BEGIN:|50-getter|0|50-preInit
    /**
     * Returns an initiliazed instance of Help component.
     * @return the initialized component instance
     */
    public Form getHelp() {
        if (Help == null) {//GEN-END:|50-getter|0|50-preInit
            // write pre-init user code here
            Help = new Form("Help", new Item[] { getSpacer3(), getTableItem(), getStringItem5() });//GEN-BEGIN:|50-getter|1|50-postInit
            Help.addCommand(getBackCommand());
            Help.setCommandListener(this);//GEN-END:|50-getter|1|50-postInit
            // write post-init user code here
        }//GEN-BEGIN:|50-getter|2|
        return Help;
    }
    //</editor-fold>//GEN-END:|50-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: Start ">//GEN-BEGIN:|58-getter|0|58-preInit
    /**
     * Returns an initiliazed instance of Start component.
     * @return the initialized component instance
     */
    public Form getStart() {
        if (Start == null) {//GEN-END:|58-getter|0|58-preInit
            // write pre-init user code here
            Start = new Form("Gross Master", new Item[] { getImageItem3() });//GEN-BEGIN:|58-getter|1|58-postInit
            Start.addCommand(getOkCommand());
            Start.addCommand(getExitCommand1());
            Start.setCommandListener(this);//GEN-END:|58-getter|1|58-postInit
            // write post-init user code here
        }//GEN-BEGIN:|58-getter|2|
        return Start;
    }
    //</editor-fold>//GEN-END:|58-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tableItem ">//GEN-BEGIN:|67-getter|0|67-preInit
    /**
     * Returns an initiliazed instance of tableItem component.
     * @return the initialized component instance
     */
    public TableItem getTableItem() {
        if (tableItem == null) {//GEN-END:|67-getter|0|67-preInit
            // write pre-init user code here
            tableItem = new TableItem(getDisplay(), "Some rules");//GEN-BEGIN:|67-getter|1|67-postInit
            tableItem.setLayout(ImageItem.LAYOUT_DEFAULT);
            tableItem.setModel(getTableModel1());//GEN-END:|67-getter|1|67-postInit
            // write post-init user code here
        }//GEN-BEGIN:|67-getter|2|
        return tableItem;
    }
    //</editor-fold>//GEN-END:|67-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: imageItem3 ">//GEN-BEGIN:|64-getter|0|64-preInit
    /**
     * Returns an initiliazed instance of imageItem3 component.
     * @return the initialized component instance
     */
    public ImageItem getImageItem3() {
        if (imageItem3 == null) {//GEN-END:|64-getter|0|64-preInit
            // write pre-init user code here
            imageItem3 = new ImageItem(" Mobile Chess", getImage3(), ImageItem.LAYOUT_DEFAULT, "<Missing Image>", Item.PLAIN);//GEN-LINE:|64-getter|1|64-postInit
            // write post-init user code here
        }//GEN-BEGIN:|64-getter|2|
        return imageItem3;
    }
    //</editor-fold>//GEN-END:|64-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image1 ">//GEN-BEGIN:|62-getter|0|62-preInit
    /**
     * Returns an initiliazed instance of image1 component.
     * @return the initialized component instance
     */
    public Image getImage1() {
        if (image1 == null) {//GEN-END:|62-getter|0|62-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|62-getter|1|62-@java.io.IOException
                image1 = Image.createImage("/belie.png");
            } catch (java.io.IOException e) {//GEN-END:|62-getter|1|62-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|62-getter|2|62-postInit
            // write post-init user code here
        }//GEN-BEGIN:|62-getter|3|
        return image1;
    }
    //</editor-fold>//GEN-END:|62-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image2 ">//GEN-BEGIN:|63-getter|0|63-preInit
    /**
     * Returns an initiliazed instance of image2 component.
     * @return the initialized component instance
     */
    public Image getImage2() {
        if (image2 == null) {//GEN-END:|63-getter|0|63-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|63-getter|1|63-@java.io.IOException
                image2 = Image.createImage("/chernie.png");
            } catch (java.io.IOException e) {//GEN-END:|63-getter|1|63-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|63-getter|2|63-postInit
            // write post-init user code here
        }//GEN-BEGIN:|63-getter|3|
        return image2;
    }
    //</editor-fold>//GEN-END:|63-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image3 ">//GEN-BEGIN:|65-getter|0|65-preInit
    /**
     * Returns an initiliazed instance of image3 component.
     * @return the initialized component instance
     */
    public Image getImage3() {
        if (image3 == null) {//GEN-END:|65-getter|0|65-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|65-getter|1|65-@java.io.IOException
                image3 = Image.createImage("/EDGE.png");
            } catch (java.io.IOException e) {//GEN-END:|65-getter|1|65-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|65-getter|2|65-postInit
            // write post-init user code here
        }//GEN-BEGIN:|65-getter|3|
        return image3;
    }
    //</editor-fold>//GEN-END:|65-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image4 ">//GEN-BEGIN:|66-getter|0|66-preInit
    /**
     * Returns an initiliazed instance of image4 component.
     * @return the initialized component instance
     */
    public Image getImage4() {
        if (image4 == null) {//GEN-END:|66-getter|0|66-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|66-getter|1|66-@java.io.IOException
                image4 = Image.createImage("/picture.png");
            } catch (java.io.IOException e) {//GEN-END:|66-getter|1|66-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|66-getter|2|66-postInit
            // write post-init user code here
        }//GEN-BEGIN:|66-getter|3|
        return image4;
    }
    //</editor-fold>//GEN-END:|66-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tableModel1 ">//GEN-BEGIN:|68-getter|0|68-preInit
    /**
     * Returns an initiliazed instance of tableModel1 component.
     * @return the initialized component instance
     */
    public SimpleTableModel getTableModel1() {
        if (tableModel1 == null) {//GEN-END:|68-getter|0|68-preInit
            // write pre-init user code here
            tableModel1 = new SimpleTableModel(new java.lang.String[][] {//GEN-BEGIN:|68-getter|1|68-postInit
                new java.lang.String[] { "1. You can play this game with a partner" },
                new java.lang.String[] { "2. This game for 2 person only" },
                new java.lang.String[] { "3. There no playing time limit" },
                new java.lang.String[] { "5. Standart chess figures: " },
                new java.lang.String[] { "King, Queen, Rook, Bishop, Knight, Pawn" }}, new java.lang.String[] { "" });//GEN-END:|68-getter|1|68-postInit
            // write post-init user code here
        }//GEN-BEGIN:|68-getter|2|
        return tableModel1;
    }
    //</editor-fold>//GEN-END:|68-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: form3 ">//GEN-BEGIN:|69-getter|0|69-preInit
    /**
     * Returns an initiliazed instance of form3 component.
     * @return the initialized component instance
     */
    public Form getForm3() {
        if (form3 == null) {//GEN-END:|69-getter|0|69-preInit
            // write pre-init user code here
            form3 = new Form("form3", new Item[] { getStringItem6(), getImageItem2(), getSpacer(), getImageItem4() });//GEN-BEGIN:|69-getter|1|69-postInit
            form3.addCommand(getExitCommand());
            form3.addCommand(getOkCommand());
            form3.setCommandListener(this);//GEN-END:|69-getter|1|69-postInit
            // write post-init user code here
        }//GEN-BEGIN:|69-getter|2|
        return form3;
    }
    //</editor-fold>//GEN-END:|69-getter|2|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image5 ">//GEN-BEGIN:|74-getter|0|74-preInit
    /**
     * Returns an initiliazed instance of image5 component.
     * @return the initialized component instance
     */
    public Image getImage5() {
        if (image5 == null) {//GEN-END:|74-getter|0|74-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|74-getter|1|74-@java.io.IOException
                image5 = Image.createImage("/bernashchess.png");
            } catch (java.io.IOException e) {//GEN-END:|74-getter|1|74-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|74-getter|2|74-postInit
            // write post-init user code here
        }//GEN-BEGIN:|74-getter|3|
        return image5;
    }
    //</editor-fold>//GEN-END:|74-getter|3|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image6 ">//GEN-BEGIN:|77-getter|0|77-preInit
    /**
     * Returns an initiliazed instance of image6 component.
     * @return the initialized component instance
     */
    public Image getImage6() {
        if (image6 == null) {//GEN-END:|77-getter|0|77-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|77-getter|1|77-@java.io.IOException
                image6 = Image.createImage("/kapustnik.png");
            } catch (java.io.IOException e) {//GEN-END:|77-getter|1|77-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|77-getter|2|77-postInit
            // write post-init user code here
        }//GEN-BEGIN:|77-getter|3|
        return image6;
    }
    //</editor-fold>//GEN-END:|77-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: cancelCommand ">//GEN-BEGIN:|79-getter|0|79-preInit
    /**
     * Returns an initiliazed instance of cancelCommand component.
     * @return the initialized component instance
     */
    public Command getCancelCommand() {
        if (cancelCommand == null) {//GEN-END:|79-getter|0|79-preInit
            // write pre-init user code here
            cancelCommand = new Command("Cancel", Command.CANCEL, 0);//GEN-LINE:|79-getter|1|79-postInit
            // write post-init user code here
        }//GEN-BEGIN:|79-getter|2|
        return cancelCommand;
    }
    //</editor-fold>//GEN-END:|79-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand1 ">//GEN-BEGIN:|81-getter|0|81-preInit
    /**
     * Returns an initiliazed instance of exitCommand1 component.
     * @return the initialized component instance
     */
    public Command getExitCommand1() {
        if (exitCommand1 == null) {//GEN-END:|81-getter|0|81-preInit
            // write pre-init user code here
            exitCommand1 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|81-getter|1|81-postInit
            // write post-init user code here
        }//GEN-BEGIN:|81-getter|2|
        return exitCommand1;
    }
    //</editor-fold>//GEN-END:|81-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand1 ">//GEN-BEGIN:|84-getter|0|84-preInit
    /**
     * Returns an initiliazed instance of okCommand1 component.
     * @return the initialized component instance
     */
    public Command getOkCommand1() {
        if (okCommand1 == null) {//GEN-END:|84-getter|0|84-preInit
            // write pre-init user code here
            okCommand1 = new Command("Ok", Command.OK, 0);//GEN-LINE:|84-getter|1|84-postInit
            // write post-init user code here
        }//GEN-BEGIN:|84-getter|2|
        return okCommand1;
    }
    //</editor-fold>//GEN-END:|84-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">//GEN-BEGIN:|86-getter|0|86-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|86-getter|0|86-preInit
            // write pre-init user code here
            backCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|86-getter|1|86-postInit
            // write post-init user code here
        }//GEN-BEGIN:|86-getter|2|
        return backCommand;
    }
    //</editor-fold>//GEN-END:|86-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem1 ">//GEN-BEGIN:|98-getter|0|98-preInit
    /**
     * Returns an initiliazed instance of stringItem1 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem1() {
        if (stringItem1 == null) {//GEN-END:|98-getter|0|98-preInit
            // write pre-init user code here
            stringItem1 = new StringItem("             Main Menu", "                             Gross Master", Item.PLAIN);//GEN-BEGIN:|98-getter|1|98-postInit
            stringItem1.setItemCommandListener(this);//GEN-END:|98-getter|1|98-postInit
            // write post-init user code here
        }//GEN-BEGIN:|98-getter|2|
        return stringItem1;
    }
    //</editor-fold>//GEN-END:|98-getter|2|









    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: spacer3 ">//GEN-BEGIN:|90-getter|0|90-preInit
    /**
     * Returns an initiliazed instance of spacer3 component.
     * @return the initialized component instance
     */
    public Spacer getSpacer3() {
        if (spacer3 == null) {//GEN-END:|90-getter|0|90-preInit
            // write pre-init user code here
            spacer3 = new Spacer(16, 1);//GEN-LINE:|90-getter|1|90-postInit
            // write post-init user code here
        }//GEN-BEGIN:|90-getter|2|
        return spacer3;
    }
    //</editor-fold>//GEN-END:|90-getter|2|











    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Items ">//GEN-BEGIN:|17-itemCommandAction|0|17-preItemCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular item.
     * @param command the Command that was invoked
     * @param displayable the Item where the command was invoked
     */
    public void commandAction(Command command, Item item) {//GEN-END:|17-itemCommandAction|0|17-preItemCommandAction
        // write pre-action user code here
        if (item == stringItem) {//GEN-BEGIN:|17-itemCommandAction|1|130-preAction
            if (command == okCommand1) {//GEN-END:|17-itemCommandAction|1|130-preAction
                // write pre-action user code here
//GEN-LINE:|17-itemCommandAction|2|130-postAction
                // write post-action user code here
            }//GEN-BEGIN:|17-itemCommandAction|3|131-preAction
        } else if (item == stringItem2) {
            if (command == okCommand1) {//GEN-END:|17-itemCommandAction|3|131-preAction
                // write pre-action user code here
//GEN-LINE:|17-itemCommandAction|4|131-postAction
                // write post-action user code here
            }//GEN-BEGIN:|17-itemCommandAction|5|132-preAction
        } else if (item == stringItem3) {
            if (command == okCommand1) {//GEN-END:|17-itemCommandAction|5|132-preAction
                // write pre-action user code here
                switchDisplayable(null, getHelp());//GEN-LINE:|17-itemCommandAction|6|132-postAction
                // write post-action user code here
            }//GEN-BEGIN:|17-itemCommandAction|7|133-preAction
        } else if (item == stringItem4) {
            if (command == exitCommand1) {//GEN-END:|17-itemCommandAction|7|133-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|17-itemCommandAction|8|133-postAction
                // write post-action user code here
            }//GEN-BEGIN:|17-itemCommandAction|9|17-postItemCommandAction
        }//GEN-END:|17-itemCommandAction|9|17-postItemCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|17-itemCommandAction|10|
    //</editor-fold>//GEN-END:|17-itemCommandAction|10|






    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem ">//GEN-BEGIN:|124-getter|0|124-preInit
    /**
     * Returns an initiliazed instance of stringItem component.
     * @return the initialized component instance
     */
    public StringItem getStringItem() {
        if (stringItem == null) {//GEN-END:|124-getter|0|124-preInit
            // write pre-init user code here
            stringItem = new StringItem("", "             New Game", Item.BUTTON);//GEN-BEGIN:|124-getter|1|124-postInit
            stringItem.addCommand(getOkCommand1());
            stringItem.setItemCommandListener(this);
            stringItem.setDefaultCommand(getOkCommand1());//GEN-END:|124-getter|1|124-postInit
            // write post-init user code here
        }//GEN-BEGIN:|124-getter|2|
        return stringItem;
    }
    //</editor-fold>//GEN-END:|124-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem2 ">//GEN-BEGIN:|125-getter|0|125-preInit
    /**
     * Returns an initiliazed instance of stringItem2 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem2() {
        if (stringItem2 == null) {//GEN-END:|125-getter|0|125-preInit
            // write pre-init user code here
            stringItem2 = new StringItem("", "        Saved Games", Item.BUTTON);//GEN-BEGIN:|125-getter|1|125-postInit
            stringItem2.addCommand(getOkCommand1());
            stringItem2.setItemCommandListener(this);
            stringItem2.setDefaultCommand(getOkCommand1());//GEN-END:|125-getter|1|125-postInit
            // write post-init user code here
        }//GEN-BEGIN:|125-getter|2|
        return stringItem2;
    }
    //</editor-fold>//GEN-END:|125-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem3 ">//GEN-BEGIN:|126-getter|0|126-preInit
    /**
     * Returns an initiliazed instance of stringItem3 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem3() {
        if (stringItem3 == null) {//GEN-END:|126-getter|0|126-preInit
            // write pre-init user code here
            stringItem3 = new StringItem("", "                        Help", Item.BUTTON);//GEN-BEGIN:|126-getter|1|126-postInit
            stringItem3.addCommand(getOkCommand1());
            stringItem3.setItemCommandListener(this);
            stringItem3.setDefaultCommand(getOkCommand1());//GEN-END:|126-getter|1|126-postInit
            // write post-init user code here
        }//GEN-BEGIN:|126-getter|2|
        return stringItem3;
    }
    //</editor-fold>//GEN-END:|126-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem4 ">//GEN-BEGIN:|127-getter|0|127-preInit
    /**
     * Returns an initiliazed instance of stringItem4 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem4() {
        if (stringItem4 == null) {//GEN-END:|127-getter|0|127-preInit
            // write pre-init user code here
            stringItem4 = new StringItem("", "                         Exit", Item.BUTTON);//GEN-BEGIN:|127-getter|1|127-postInit
            stringItem4.addCommand(getExitCommand1());
            stringItem4.setItemCommandListener(this);
            stringItem4.setDefaultCommand(getExitCommand1());//GEN-END:|127-getter|1|127-postInit
            // write post-init user code here
        }//GEN-BEGIN:|127-getter|2|
        return stringItem4;
    }
    //</editor-fold>//GEN-END:|127-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: spacer4 ">//GEN-BEGIN:|128-getter|0|128-preInit
    /**
     * Returns an initiliazed instance of spacer4 component.
     * @return the initialized component instance
     */
    public Spacer getSpacer4() {
        if (spacer4 == null) {//GEN-END:|128-getter|0|128-preInit
            // write pre-init user code here
            spacer4 = new Spacer(16, 1);//GEN-LINE:|128-getter|1|128-postInit
            // write post-init user code here
        }//GEN-BEGIN:|128-getter|2|
        return spacer4;
    }
    //</editor-fold>//GEN-END:|128-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: imageItem1 ">//GEN-BEGIN:|129-getter|0|129-preInit
    /**
     * Returns an initiliazed instance of imageItem1 component.
     * @return the initialized component instance
     */
    public ImageItem getImageItem1() {
        if (imageItem1 == null) {//GEN-END:|129-getter|0|129-preInit
            // write pre-init user code here
            imageItem1 = new ImageItem("", getImage1(), ImageItem.LAYOUT_DEFAULT, "<Missing Image>");//GEN-LINE:|129-getter|1|129-postInit
            // write post-init user code here
        }//GEN-BEGIN:|129-getter|2|
        return imageItem1;
    }
    //</editor-fold>//GEN-END:|129-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: imageItem ">//GEN-BEGIN:|141-getter|0|141-preInit
    /**
     * Returns an initiliazed instance of imageItem component.
     * @return the initialized component instance
     */
    public ImageItem getImageItem() {
        if (imageItem == null) {//GEN-END:|141-getter|0|141-preInit
            // write pre-init user code here
            imageItem = new ImageItem("", getImage2(), ImageItem.LAYOUT_DEFAULT, "<Missing Image>");//GEN-LINE:|141-getter|1|141-postInit
            // write post-init user code here
        }//GEN-BEGIN:|141-getter|2|
        return imageItem;
    }
    //</editor-fold>//GEN-END:|141-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: ticker ">//GEN-BEGIN:|140-getter|0|140-preInit
    /**
     * Returns an initiliazed instance of ticker component.
     * @return the initialized component instance
     */
    public Ticker getTicker() {
        if (ticker == null) {//GEN-END:|140-getter|0|140-preInit
            // write pre-init user code here
            ticker = new Ticker("Become A Gross Master Playing This Game!");//GEN-LINE:|140-getter|1|140-postInit
            // write post-init user code here
        }//GEN-BEGIN:|140-getter|2|
        return ticker;
    }
    //</editor-fold>//GEN-END:|140-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: font1 ">//GEN-BEGIN:|142-getter|0|142-preInit
    /**
     * Returns an initiliazed instance of font1 component.
     * @return the initialized component instance
     */
    public Font getFont1() {
        if (font1 == null) {//GEN-END:|142-getter|0|142-preInit
            // write pre-init user code here
            font1 = Font.getDefaultFont();//GEN-LINE:|142-getter|1|142-postInit
            // write post-init user code here
        }//GEN-BEGIN:|142-getter|2|
        return font1;
    }
    //</editor-fold>//GEN-END:|142-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem5 ">//GEN-BEGIN:|146-getter|0|146-preInit
    /**
     * Returns an initiliazed instance of stringItem5 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem5() {
        if (stringItem5 == null) {//GEN-END:|146-getter|0|146-preInit
            // write pre-init user code here
            stringItem5 = new StringItem("Developer:", "Bernar Sultanov, IITU, CSSE 0905");//GEN-LINE:|146-getter|1|146-postInit
            // write post-init user code here
        }//GEN-BEGIN:|146-getter|2|
        return stringItem5;
    }
    //</editor-fold>//GEN-END:|146-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem6 ">//GEN-BEGIN:|148-getter|0|148-preInit
    /**
     * Returns an initiliazed instance of stringItem6 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem6() {
        if (stringItem6 == null) {//GEN-END:|148-getter|0|148-preInit
            // write pre-init user code here
            stringItem6 = new StringItem("Begin New Game", "");//GEN-LINE:|148-getter|1|148-postInit
            // write post-init user code here
        }//GEN-BEGIN:|148-getter|2|
        return stringItem6;
    }
    //</editor-fold>//GEN-END:|148-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image7 ">//GEN-BEGIN:|150-getter|0|150-preInit
    /**
     * Returns an initiliazed instance of image7 component.
     * @return the initialized component instance
     */
    public Image getImage7() {
        if (image7 == null) {//GEN-END:|150-getter|0|150-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|150-getter|1|150-@java.io.IOException
                image7 = Image.createImage("/kinger.png");
            } catch (java.io.IOException e) {//GEN-END:|150-getter|1|150-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|150-getter|2|150-postInit
            // write post-init user code here
        }//GEN-BEGIN:|150-getter|3|
        return image7;
    }
    //</editor-fold>//GEN-END:|150-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: imageItem2 ">//GEN-BEGIN:|152-getter|0|152-preInit
    /**
     * Returns an initiliazed instance of imageItem2 component.
     * @return the initialized component instance
     */
    public ImageItem getImageItem2() {
        if (imageItem2 == null) {//GEN-END:|152-getter|0|152-preInit
            // write pre-init user code here
            imageItem2 = new ImageItem("imageItem2", null, ImageItem.LAYOUT_DEFAULT, "<Missing Image>");//GEN-LINE:|152-getter|1|152-postInit
            // write post-init user code here
        }//GEN-BEGIN:|152-getter|2|
        return imageItem2;
    }
    //</editor-fold>//GEN-END:|152-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: spacer ">//GEN-BEGIN:|153-getter|0|153-preInit
    /**
     * Returns an initiliazed instance of spacer component.
     * @return the initialized component instance
     */
    public Spacer getSpacer() {
        if (spacer == null) {//GEN-END:|153-getter|0|153-preInit
            // write pre-init user code here
            spacer = new Spacer(16, 1);//GEN-LINE:|153-getter|1|153-postInit
            // write post-init user code here
        }//GEN-BEGIN:|153-getter|2|
        return spacer;
    }
    //</editor-fold>//GEN-END:|153-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: imageItem4 ">//GEN-BEGIN:|154-getter|0|154-preInit
    /**
     * Returns an initiliazed instance of imageItem4 component.
     * @return the initialized component instance
     */
    public ImageItem getImageItem4() {
        if (imageItem4 == null) {//GEN-END:|154-getter|0|154-preInit
            // write pre-init user code here
            imageItem4 = new ImageItem("imageItem4", getImage7(), ImageItem.LAYOUT_DEFAULT, "<Missing Image>");//GEN-LINE:|154-getter|1|154-postInit
            // write post-init user code here
        }//GEN-BEGIN:|154-getter|2|
        return imageItem4;
    }
    //</editor-fold>//GEN-END:|154-getter|2|


    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay () {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable (null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet ();
        } else {
            initialize ();
            startMIDlet ();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }

}
